package com.uenpay.im.menu;

import com.qiyunxin.android.http.net.HttpRequestType;
import com.uenpay.im.invokeitems.HttpRequestHandle;

import java.util.ArrayList;

/**
 * @Author: SL
 * @Date: 2016/11/4 16:40
 * @CopyRight: http://www.qiyunxin.com
 * @Parameter: TODO
 * @Function: 菜单管理
 */
public class MenusHandle {

    public interface IGetMenus {
        void onResult(ArrayList<MenuEntity> arrayList);
    }

    public static void getMenus(final IGetMenus mIGetMenus) {
        HttpRequestHandle.onBaseRequest(new GetMenusInvoke(), HttpRequestType.SERVER_FAIL_AND_CACHE, new HttpRequestHandle.IRequestResultListener() {
            @Override
            public void onResult(Object resultObject, boolean isCache, String failReason) {
                if (resultObject != null) {
                    GetMenusInvoke.GetHomeMenusInvokeResult result = ((GetMenusInvoke) resultObject).getOutPut();
                    if (mIGetMenus != null) {
                        mIGetMenus.onResult(result.arrayList);
                    }
                } else {
                    mIGetMenus.onResult(null);
                }
            }
        });
    }

}
